package com.study.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.study.dao.ClassesDao;
import com.study.dao.StudentDao;


@Component
public class ClassesService {
	
	@Autowired
	private StudentDao studentDao;
	
	@Autowired
	private ClassesDao classesDao;
	
	@Transactional
	public void delete(int id){
		classesDao.delete(id);
		int i=1/0;//制造一个异常，查看是否回滚
		studentDao.deleteByClassesId(id);
		
	}
	
}
